

/**
 * @description 包含部分字体样式数据，合并单元格，整行背景色
 */
export const data1 = {
    mergeCells: [
        {row: 7, col: 3, rowspan: 4, colspan: 3},
        {row: 6, col: 7, rowspan: 2, colspan: 2},
        {row: 6, col: 11, rowspan: 5, colspan: 5},
        {row: 100, col: 100, rowspan: 5, colspan: 5}
        // {row: 9, col: 7, rowspan: 2, colspan: 2}
    ],
    colConf: [{
        col: 3,
        width: 300
    }],
    fullCtrl: [
        {
            type: 'row',
            span: 1,
            position: 17,
            fill: {
                background: {
                    color: '#FF0000'
                }
            }
        }
    ],
    datas: [
        {
            row: 0,
            cells: [
                {
                    col: 0,
                    value: 'fasdjfhajds',
                    fill: {
                        background: {color: '#F0F0F0'}
                    }
                },
                {
                    col: 1,
                    value: 'underling',
                    fill: {
                        background: {color: '#F0F0F0'}
                    },
                    font: {
                        decoration: 1
                    }
                },
                {
                    col: 2,
                    value: '发生的发生地',
                    fill: {
                        background: {color: '#F0F0F0'}
                    },
                    font: {
                        decoration: 1
                    }
                },
                {
                    col: 3,
                    value: 'overline',
                    fill: {
                        background: {color: '#F0F0F0'}
                    },
                    font: {
                        decoration: 2
                    }
                },
                {
                    col: 4,
                    value: '上划线',
                    fill: {
                        background: {color: '#F0F0F0'}
                    },
                    font: {
                        decoration: 2
                    }
                },
                {
                    col: 5,
                    value: 'throughLine',
                    fill: {
                        background: {color: '#F0F0F0'}
                    },
                    font: {
                        decoration: 3
                    }
                },
                {
                    col: 6,
                    value: '删除线',
                    fill: {
                        background: {color: '#F0F0F0'}
                    },
                    font: {
                        decoration: 3
                    }
                }
            ]
        },
        {
            row: 1,
            cells: [
                {
                    col: 0,
                    font: {
                        style: 1
                    },
                    value: '斜体1'
                },
                {
                    col: 1,
                    font: {
                        style: 2
                    },
                    value: '斜体2'
                }
            ]
        },
        {
            row: 9,
            cells: [
                {
                    col: 7,
                    // fill: {
                    //     background: {color: '#F0F0F0'}
                    // }
                }
            ]
        },
        {
            row: 7,
            cells: [
                {
                    col: 3,
                    value: '罚款来得及发了快递解封啦肯定是激发了快速的减肥卢卡斯大家发了四度空间发了可是大家发来上课',
                    fill: {
                        background: {color: '#66ff66'}
                    },
                    font: {
                        autoWrap: true
                    }
                }
            ]
        },
        {
            row: 6,
            cells: [
                {
                    col: 7,
                    border: {
                        top: {
                            width: 1,
                            color: '000000',
                            type: 0
                        },
                        bottom: {
                            width: 1,
                            color: '000000',
                            type: 0
                        },
                        left: {
                            width: 1,
                            color: '000000',
                            type: 0
                        },
                        right: {
                            width: 1,
                            color: '000000',
                            type: 0
                        }
                    },
                    fill: {
                        background: {color: '#FFFFFF'}
                    }
                },
                {
                    col: 11,
                    fill: {
                        background: {color: '#66ff66'}
                    }
                }
            ]
        },
        {
            row: 15,
            cells: [
                {
                    col: 3,
                    fill: {
                        background: {color: '#FF0000'}
                    }
                }
            ]
        },
        {
            row: 3,
            height: 100,
            cells: [
                {
                    col: 2,
                    border: {
                        top: {
                            width: 1,
                            color: '000000',
                            type: 0
                        },
                        bottom: {
                            width: 1,
                            color: '000000',
                            type: 0
                        },
                        left: {
                            width: 1,
                            color: '000000',
                            type: 0
                        },
                        right: {
                            width: 1,
                            color: '000000',
                            type: 0
                        }
                    },
                    value: 'all border'
                }
            ],
            
        },
        {
            row: 0,
            cells: [
                {
                    col: 0,
                    value: 'dfasdfasd'
                }
            ]
        },
        {
            row: 13,
            cells: [
                {
                    col: 12,
                    value: '13,12'
                }
            ]
        },
        {
            row: 2,
            height: 100,
            cells: [
                {
                    col: 1,
                    font: {
                        vertical: 0,
                        color: '#FF0100'
                    },
                    value: 'fasdfa'
                },
                {
                    col: 2,
                    font: {
                        vertical: 0,
                        horizontally: 1
                    },
                    value: '的\n烧'
                },
                {
                    col: 4,
                    font: {
                        vertical: 2,
                        horizontally: 1
                    },
                    value: '下部'
                },
                {
                    col: 6,
                    fill: {background: {color: '#666633'}}
                }
            ]
        },
        {
            row: 3,
            cells: [
                {
                    col: 2,
                    value: '中国'
                },
                {
                    col: 3,
                    value: '多发点',
                    font: {
                        horizontally: 1
                    }
                },
                {
                    col: 4,
                    value: '范德萨发dfadsfadsfadsfadsfasdfadsfasd',
                    font: {
                        horizontally: 1
                    }
                },
                {
                    col: 3,
                    value: '多发1\n点dfasdfasdf的发生地发生地发啥的发生地asdfasdfasdfasdfasdfadsfasdfasdfas',
                    font: {
                        horizontally: 1,
                        autoWrap: true,
                        vertical: 1

                    }
                },
            ]
        },
        {
            row: 4,
            cells: [
                {
                    col: 3,
                    value: '钉钉',
                    font: {
                        horizontally: 2
                    }
                }
            ]
        },
        {
            row: 5,
            cells: [
                {
                    col: 0,
                    value: '132'
                }
            ]
        },
        {
            row: 5,
            cells: [
                {
                    col: 0,
                    value: '13/n2'
                }
            ]
        }
    ]
}

export const data2: any = {
    mergeCells: [],
    colConf: [],
    fullCtrl: [],
    datas: [
        {
            row: 1,
            cells: [
                {
                    col: 1,
                    type: 'text',
                    value: '1432413241234123'
                },
                // {
                //     col: 2,
                //     type: 'text',
                //     value: '131231'
                // }
            ]
        }
    ]
}
const text = `新华社乌鲁木齐7月15日电  中共中央总书记、国家主席、中央军委主席习近平近日来到新疆考察调研，看望慰问各族干部群众。习近52345234平强调，要坚决贯彻党523452345234中央决策部署，完整准确贯彻新时代党的治疆方略，牢牢扭住社会稳43523452345234定和长治久安总目标，坚持稳中求进工作总基调，全面深化改革开放，推动高质量523452345234发展，统筹疫情防控和经济社会发展，统筹发展和安全，在新时代新征程上奋力建设团结和谐、繁荣富裕、文明进步、安居乐业、生态良好的美好新疆。`
const len = text.length;
//生成从minNum到maxNum的随机数
function randomNum(minNum: number,maxNum: number){ 
    switch(arguments.length){ 
        case 1: 
        // @ts-ignore
            return parseInt(Math.random()*minNum+1,10); 
        break; 
        case 2: 
        // @ts-ignore
            return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10); 
        break; 
            default: 
                return 0; 
            break; 
    } 
}
const imgs: string[] = [
    'https://static-legacy.dingtalk.com/media/lADPDhmOtM7cq9XNAu_NAu4_750_751.jpg',
    'https://static-legacy.dingtalk.com/media/lADPDgQ9rXoKWH3NAgXNAfo_506_517.jpg',
    'https://static-legacy.dingtalk.com/media/lADPD3IrrvL_enXNAUDNAX8_383_320.jpg',
    'https://static-legacy.dingtalk.com/media/lADPDhJzx0DKjizNAxLNAxI_786_786.jpg',
    'https://static-legacy.dingtalk.com/media/lADPDgQ914CikaLMkcyR_145_145.jpg',
    'https://static-legacy.dingtalk.com/media/lADPDiQ3NfaJA7vNAn7NAoA_640_638.jpg',
    'https://static-legacy.dingtalk.com/media/lADPDg7mRbG3KAvNAuLNAwA_768_738.jpg',
    'https://static-legacy.dingtalk.com/media/lADPD3W5OlbYbDDNAjLNAjM_563_562.jpg',
    'https://static-legacy.dingtalk.com/media/lADPDgfLTEQxpDrNASzNASw_300_300.jpg',
    'https://static-legacy.dingtalk.com/media/lADPDhYBKgyiGDnNAybNAg0_525_806.jpg'
];
function randomImage() {
    return imgs[randomNum(0, imgs.length)]
}
export const userData: any = {
    mergeCells: [],
    colConf: [],
    fullCtrl: [],
    datas: [
        {
            row: 1,
            cells: [
                {
                    col: 1,
                    type: 'users',
                    value: [
                        {
                            name: '刘德华',
                            avatar: randomImage()
                        },
                        {
                            name: '黄奕',
                            avatar: randomImage()
                        },
                        {
                            name: '周星驰',
                            avatar: ''
                        }
                    ]
                },
                {
                    col: 2,
                    type: 'users',
                    value: [
                        {
                            name: '周星驰',
                            avatar: ''
                        }
                    ]
                }
            ]
        }
    ]
}
function randomStr() {
    let start = randomNum(0, text.length - 10);
    let end = randomNum(start, text.length);
    end = end - 10 > start ? start + 10 : end;
    return text.substring(start, end);
}
export function getMoreData(maxRow: number, maxCol: number) {
    const data: any = {
        mergeCells: [],
        colConf: [],
        fullCtrl: [],
        datas: [

        ]
    }
    for(let i = 0; i < maxRow; i++) {
        let row: {row: number, cells: {col: number, type: string, value: string}[]} = {
            row: i,
            cells: []
        }
        for(let j = 0; j < maxCol; j++) {
            let str = randomStr();
            row.cells.push({
                col: j,
                type: 'text',
                value: str
            })
        }
        data.datas.push(row);
    }
    return data;
}

export function createHeader() {
    let widthCol = 0;
    const createWidth = (w: number) => {
        return {col: widthCol++, width: w}
    }
    let data: any = {
        mergeCells: [],
        colConf: [
            createWidth(80),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120),
            createWidth(120)
        ],
        fullCtrl: [],
        datas: [

        ]
    }
    let col = 0;
    const header = (type: string, name: string) => {
        let temp = {
            col: col,
            fill: {background: {color: '#F7F8FF'}},
            type: 'header',
            value: {
                type: type,
                name: name
            }
        }
        col++;
        return temp;
    }
    data.datas = [
        {
            row: 0,
            cells: [
                header('number', 'ID'),
                header('text', '单行文本'),
                header('textarea', '多行文本'),
                header('select_color', '下拉单选'),
                header('multiple_select', '下拉复选'),
                header('number', '数字'),
                header('date', '单日期'),
                header('date_range', '日期范围'),
                header('email', '邮箱'),
                header('telephone', '电话'),
                header('hyperlinks', '超链接'),
                header('file', '文件'),
                header('ref', '关联他表'),
                header('member', '用户'),
                header('dictionary', '字典'),
                header('area', '地区'),
                header('member', '创建人'),
                header('member', '最后修改人'),
                header('date', '创建时间'),
                header('date', '最后修改时间')
            ]
        }
    ]
    return data;
}

export const selectColorData: any = {
    mergeCells: [],
    colConf: [
    ],
    fullCtrl: [],
    datas: [
        {
            row: 1,
            cells: [
                {
                    col: 1,
                    type: 'select-color',
                    value: {
                        text: '选择项1',
                        color: 'rgb(255, 100, 100)'
                    }
                }
            ]
        }
    ]
}

export const MutipleSelectData: any = {
    mergeCells: [],
    colConf: [
        {
            col: 1,
            width: 200
        }
    ],
    fullCtrl: [],
    datas: [
        {
            row: 1,
            cells: [
                {
                    col: 1,
                    type: 'multiple-select',
                    value: [
                        {
                            text: '发射点发哈力克点击返回绿卡的时间flak但是'
                        },
                        {
                            text: 'DFADSFS'
                        }
                    ]
                }
            ]
        }
    ]
}

export const linkDate: any = {
    mergeCells: [],
    colConf: [
        {
            col: 1,
            width: 200
        }
    ],
    fullCtrl: [],
    datas: [
        {
            row: 1,
            cells: [
                {
                    col: 1,
                    type: 'hyperlinks',
                    value: [
                        {
                            url: 'https://mvp.captain-cro.com/project-manager/project/2067/info?type=task'
                        },
                        {
                            url: 'https://release-mvp.captain-cro.com/fonticons/iconfont.js'
                        }
                    ]
                }
            ]
        }
    ]
}

export const fileData: any = {
    mergeCells: [],
    colConf: [
        {
            col: 1,
            width: 100
        }
    ],
    fullCtrl: [],
    datas: [
        {
            row: 1,
            cells: [
                {
                    col: 1,
                    type: 'file',
                    value: [
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'zip'
                        },
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'png'
                        },
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'jpg'
                        },
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'zip'
                        },
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'png'
                        },
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'jpg'
                        },
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'zip'
                        },
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'png'
                        },
                        {
                            name: '吴钰-入职资料（RMCC助理）.zip',
                            type: 'jpg'
                        },
                    ]
                }
            ]
        }
    ]
}

export const relationData: any = {
    mergeCells: [],
    colConf: [
        {
            col: 1,
            width: 100
        }
    ],
    fullCtrl: [],
    datas: [
        {
            row: 1,
            cells: [
                {
                    col: 1,
                    type: 'ref',
                    value: {
                        type: 'text',
                        list: ['123', 'dfasdfasdfasdfa']
                    }
                },
                {
                    col: 2,
                    type: 'ref',
                    value: {
                        type: 'user',
                        list: [
                            {
                                name: '刘德华',
                                avatar: randomImage()
                            },
                            {
                                name: '黄奕',
                                avatar: randomImage()
                            },
                            {
                                name: '周星驰',
                                avatar: ''
                            }
                        ]
                    }
                }, 
                {
                    col: 3,
                    type: 'ref',
                    value: {
                        type: 'file',
                        list: [
                            {
                                name: '吴钰-入职资料（RMCC助理）.zip',
                                type: 'zip'
                            },
                            {
                                name: '吴钰-入职资料（RMCC助理）.zip',
                                type: 'png'
                            },
                            {
                                name: '吴钰-入职资料（RMCC助理）.zip',
                                type: 'jpg'
                            },
                        ]
                    }
                }
            ]
        }
    ]
}